// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   VAxisLabel.java

package com.java4less.rchart;

import com.java4less.rchart.gc.ChartColor;
import com.java4less.rchart.gc.ChartFont;
import com.java4less.rchart.gc.ChartGraphics;

// Referenced classes of package com.java4less.rchart:
//			AxisLabel, ChartLabel

public class VAxisLabel extends AxisLabel
{

	public VAxisLabel(String t, ChartColor c, ChartFont f)
	{
		super(t, c, f);
	}

	public void draw(ChartGraphics g)
	{
		g.setFont(font);
		g.setColor(color);
		if (title.indexOf("@") >= 0)
		{
			ChartLabel formattedLabel = new ChartLabel(title, "", vertical, true);
			formattedLabel.initialize(g, chart);
			formattedLabel.paint(g, x + width / 3, y + height / 3, 10, 10);
			return;
		}
		if (vertical && g.drawRotatedText(font, color, title, 90, x + (width - g.getFontHeight()) / 2, y + (height - g.getFontWidth(title)) / 2, true))
			return;
		int w = g.getFontWidth(null, "X");
		int toCenterX = 0;
		if (w < width)
			toCenterX = (width - w) / 2;
		int charHeight = g.getFontHeight(null);
		charHeight = (int)((double)charHeight + (double)charHeight * 0.20000000000000001D);
		int h = charHeight * title.length();
		int toCenterY = 0;
		if (h < height)
			toCenterY = (height - h) / 2;
		int offset = toCenterY + charHeight;
		for (int i = 0; i < title.length(); i++)
		{
			g.drawString(title.substring(i, i + 1), x + toCenterX, y + offset);
			offset += charHeight;
		}

	}
}
